|
Code location |
Code |
Model object |
Details |
|
1 |
/*
|
|
Nonfunctional code (Comment) |
|
2 |
* File: Altitude_Mode.c
|
|
Nonfunctional code (Comment) |
|
3 |
*
|
|
Nonfunctional code (Comment) |
|
4 |
* Code generated for Simulink model 'Altitude_Mode'.
|
|
Nonfunctional code (Comment) |
|
5 |
*
|
|
Nonfunctional code (Comment) |
|
6 |
* Model version : 1.100
|
|
Nonfunctional code (Comment) |
|
7 |
* Simulink Coder version : 8.5 (R2013b) 08-Aug-2013
|
|
Nonfunctional code (Comment) |
|
8 |
* C/C++ source code generated on : Mon Feb 03 08:13:10 2014
|
|
Nonfunctional code (Comment) |
|
9 |
*
|
|
Nonfunctional code (Comment) |
|
10 |
* Target selection: ert.tlc
|
|
Nonfunctional code (Comment) |
|
11 |
* Embedded hardware selection: 32-bit Embedded Processor
|
|
Nonfunctional code (Comment) |
|
12 |
* Code generation objectives: Unspecified
|
|
Nonfunctional code (Comment) |
|
13 |
* Validation result: Not run
|
|
Nonfunctional code (Comment) |
|
14 |
*/
|
|
Nonfunctional code (Comment) |
|
15 |
|
|
Nonfunctional code (Empty line) |
|
16 |
#include "Altitude_Mode.h"
|
|
Not processed (Include statement) |
|
17 |
#include "Altitude_Mode_private.h"
|
|
Not processed (Include statement) |
|
18 |
|
|
Nonfunctional code (Empty line) |
|
19 |
/* Start for referenced model: 'Altitude_Mode' */
|
|
Nonfunctional code (Comment) |
|
20 |
void Altitude_Mode_Start(rtB_Altitude_Mode *localB)
|
|
- |
|
21 |
{
|
|
Nonfunctional code (Start of code segment) |
|
22 |
/* Start for Probe: '<S4>/Probe' */
|
|
Nonfunctional code (Comment) |
|
23 |
localB->Probe[0U] = 0.025;
|
|
- |
|
24 |
localB->Probe[1U] = 0.0;
|
|
- |
|
25 |
}
|
|
Nonfunctional code (End of code segment) |
|
26 |
|
|
Nonfunctional code (Empty line) |
|
27 |
/* Output and update for referenced model: 'Altitude_Mode' */
|
|
Nonfunctional code (Comment) |
|
28 |
void Altitude_Mode(const real_T *rtu_AltRef, const real_T *rtu_Alt, const real_T... |
|
- |
|
29 |
*rtu_AltRate, const real_T *rtu_TAS, const real_T *rtu_Theta,... |
|
- |
|
30 |
const boolean_T *rtu_ALTMode, real_T *rty_ThetaCmd,
|
|
- |
|
31 |
rtB_Altitude_Mode *localB, rtDW_Altitude_Mode *localDW)
|
|
- |
|
32 |
{
|
|
Nonfunctional code (Start of code segment) |
|
33 |
/* local block i/o variables */
|
|
Nonfunctional code (Comment) |
|
34 |
real_T rtb_UkYk1;
|
|
Local variable declaration |
|
35 |
real_T rtb_Switch;
|
|
Local variable declaration |
|
36 |
boolean_T rtb_NotALT;
|
|
Local variable declaration |
|
37 |
real_T rtb_UnitConversion;
|
|
Local variable declaration |
|
38 |
real_T rtb_Switch_o3ad;
|
|
Local variable declaration |
|
39 |
real_T rtb_Sum3;
|
|
Local variable declaration |
|
40 |
real_T rtb_Saturation;
|
|
Local variable declaration |
|
41 |
real_T rtb_Saturation_krec;
|
|
Local variable declaration |
|
42 |
real_T rtb_deltariselimit;
|
|
Local variable declaration |
|
43 |
real_T rtb_deltafalllimit;
|
|
Local variable declaration |
|
44 |
real_T rtb_Switch2;
|
|
Local variable declaration |
|
45 |
real_T u;
|
|
Local variable declaration |
|
46 |
|
|
Nonfunctional code (Empty line) |
|
47 |
/* Logic: '<Root>/Not ALT' */
|
|
Nonfunctional code (Comment) |
|
48 |
rtb_NotALT = !(*rtu_ALTMode);
|
|
- |
|
49 |
|
|
Nonfunctional code (Empty line) |
|
50 |
/* Switch: '<Root>/Switch' incorporates:
|
|
Nonfunctional code (Comment) |
|
51 |
* Constant: '<Root>/ALT G limit'
|
|
Nonfunctional code (Comment) |
|
52 |
* Constant: '<Root>/Other G limit'
|
|
Nonfunctional code (Comment) |
|
53 |
*/
|
|
Nonfunctional code (Comment) |
|
54 |
if (rtb_NotALT) {
|
|
- |
|
55 |
rtb_UnitConversion = 32.2;
|
|
- |
|
56 |
} else {
|
|
- |
|
57 |
rtb_UnitConversion = 6.44;
|
|
- |
|
58 |
}
|
|
Nonfunctional code (End of code segment) |
|
59 |
|
|
Nonfunctional code (Empty line) |
|
60 |
/* End of Switch: '<Root>/Switch' */
|
|
Nonfunctional code (Comment) |
|
61 |
|
|
Nonfunctional code (Empty line) |
|
62 |
/* MinMax: '<Root>/MinMax' incorporates:
|
|
Nonfunctional code (Comment) |
|
63 |
* Constant: '<Root>/Min TAS'
|
|
Nonfunctional code (Comment) |
|
64 |
*/
|
|
Nonfunctional code (Comment) |
|
65 |
if ((*rtu_TAS) >= 100.0) {
|
|
- |
|
66 |
rtb_Switch_o3ad = *rtu_TAS;
|
|
- |
|
67 |
} else {
|
|
- |
|
68 |
rtb_Switch_o3ad = 100.0;
|
|
- |
|
69 |
}
|
|
Nonfunctional code (End of code segment) |
|
70 |
|
|
Nonfunctional code (Empty line) |
|
71 |
/* End of MinMax: '<Root>/MinMax' */
|
|
Nonfunctional code (Comment) |
|
72 |
|
|
Nonfunctional code (Empty line) |
|
73 |
/* Gain: '<S1>/Unit Conversion' incorporates:
|
|
Nonfunctional code (Comment) |
|
74 |
* Product: '<Root>/Product'
|
|
Nonfunctional code (Comment) |
|
75 |
*/
|
|
Nonfunctional code (Comment) |
|
76 |
rtb_UnitConversion = 57.295779513082323 * (rtb_UnitConversion /
|
|
- |
|
77 |
rtb_Switch_o3ad);
|
|
- |
|
78 |
|
|
Nonfunctional code (Empty line) |
|
79 |
/* Sum: '<Root>/Sum' */
|
|
Nonfunctional code (Comment) |
|
80 |
localB->altError = (*rtu_AltRef) - (*rtu_Alt);
|
|
- |
|
81 |
|
|
Nonfunctional code (Empty line) |
|
82 |
/* Lookup_n-D: '<Root>/Lookup Table' */
|
|
Nonfunctional code (Comment) |
|
83 |
rtb_Sum3 = look1_binlag(localB->altError, rtCP_LookupTable_bp01Data,
|
|
- |
|
84 |
rtCP_LookupTable_tableData, 7U);
|
|
- |
|
85 |
|
|
Nonfunctional code (Empty line) |
|
86 |
/* Gain: '<S2>/Unit Conversion' incorporates:
|
|
Nonfunctional code (Comment) |
|
87 |
* Product: '<Root>/Gamma Cmd'
|
|
Nonfunctional code (Comment) |
|
88 |
* Sum: '<Root>/Sum1'
|
|
Nonfunctional code (Comment) |
|
89 |
*/
|
|
Nonfunctional code (Comment) |
|
90 |
u = 57.295779513082323 * ((rtb_Sum3 - (*rtu_AltRate)) / rtb_Switch_o3ad);
|
|
- |
|
91 |
|
|
Nonfunctional code (Empty line) |
|
92 |
/* Saturate: '<Root>/Saturation' */
|
|
Nonfunctional code (Comment) |
|
93 |
if (u >= 20.0) {
|
|
- |
|
94 |
rtb_Saturation = 20.0;
|
|
- |
|
95 |
} else if (u <= (-20.0)) {
|
|
- |
|
96 |
rtb_Saturation = (-20.0);
|
|
- |
|
97 |
} else {
|
|
- |
|
98 |
rtb_Saturation = u;
|
|
- |
|
99 |
}
|
|
Nonfunctional code (End of code segment) |
|
100 |
|
|
Nonfunctional code (Empty line) |
|
101 |
/* End of Saturate: '<Root>/Saturation' */
|
|
Nonfunctional code (Comment) |
|
102 |
|
|
Nonfunctional code (Empty line) |
|
103 |
/* Sum: '<Root>/Sum3' */
|
|
Nonfunctional code (Comment) |
|
104 |
rtb_Sum3 = (*rtu_Theta) - rtb_Saturation;
|
|
- |
|
105 |
|
|
Nonfunctional code (Empty line) |
|
106 |
/* UnitDelay: '<S5>/X' */
|
|
Nonfunctional code (Comment) |
|
107 |
rtb_Switch_o3ad = localDW->X_DSTATE;
|
|
- |
|
108 |
|
|
Nonfunctional code (Empty line) |
|
109 |
/* Switch: '<S5>/Switch' */
|
|
Nonfunctional code (Comment) |
|
110 |
if (rtb_NotALT) {
|
|
- |
|
111 |
rtb_Switch_o3ad = rtb_Sum3;
|
|
- |
|
112 |
}
|
|
Nonfunctional code (End of code segment) |
|
113 |
|
|
Nonfunctional code (Empty line) |
|
114 |
/* End of Switch: '<S5>/Switch' */
|
|
Nonfunctional code (Comment) |
|
115 |
|
|
Nonfunctional code (Empty line) |
|
116 |
/* Saturate: '<S5>/Saturation' */
|
|
Nonfunctional code (Comment) |
|
117 |
if (rtb_Switch_o3ad >= 20.0) {
|
|
- |
|
118 |
rtb_Saturation_krec = 20.0;
|
|
- |
|
119 |
} else if (rtb_Switch_o3ad <= (-20.0)) {
|
|
- |
|
120 |
rtb_Saturation_krec = (-20.0);
|
|
- |
|
121 |
} else {
|
|
- |
|
122 |
rtb_Saturation_krec = rtb_Switch_o3ad;
|
|
- |
|
123 |
}
|
|
Nonfunctional code (End of code segment) |
|
124 |
|
|
Nonfunctional code (Empty line) |
|
125 |
/* End of Saturate: '<S5>/Saturation' */
|
|
Nonfunctional code (Comment) |
|
126 |
|
|
Nonfunctional code (Empty line) |
|
127 |
/* Sum: '<S4>/Difference Inputs1' incorporates:
|
|
Nonfunctional code (Comment) |
|
128 |
* Sum: '<Root>/Sum2'
|
|
Nonfunctional code (Comment) |
|
129 |
* UnitDelay: '<S4>/Delay Input2'
|
|
Nonfunctional code (Comment) |
|
130 |
*/
|
|
Nonfunctional code (Comment) |
|
131 |
rtb_UkYk1 = (rtb_Saturation + rtb_Saturation_krec) -
|
|
- |
|
132 |
localDW->DelayInput2_DSTATE;
|
|
- |
|
133 |
|
|
Nonfunctional code (Empty line) |
|
134 |
/* Product: '<S4>/delta rise limit' */
|
|
Nonfunctional code (Comment) |
|
135 |
rtb_deltariselimit = rtb_UnitConversion * localB->Probe[0];
|
|
- |
|
136 |
|
|
Nonfunctional code (Empty line) |
|
137 |
/* Product: '<S4>/delta fall limit' incorporates:
|
|
Nonfunctional code (Comment) |
|
138 |
* Gain: '<Root>/negate'
|
|
Nonfunctional code (Comment) |
|
139 |
*/
|
|
Nonfunctional code (Comment) |
|
140 |
rtb_deltafalllimit = ((-1.0) * rtb_UnitConversion) * localB->Probe[0];
|
|
- |
|
141 |
|
|
Nonfunctional code (Empty line) |
|
142 |
/* Switch: '<S6>/Switch' incorporates:
|
|
Nonfunctional code (Comment) |
|
143 |
* RelationalOperator: '<S6>/UpperRelop'
|
|
Nonfunctional code (Comment) |
|
144 |
*/
|
|
Nonfunctional code (Comment) |
|
145 |
if (rtb_UkYk1 < rtb_deltafalllimit) {
|
|
- |
|
146 |
rtb_Switch = rtb_deltafalllimit;
|
|
- |
|
147 |
} else {
|
|
- |
|
148 |
rtb_Switch = rtb_UkYk1;
|
|
- |
|
149 |
}
|
|
Nonfunctional code (End of code segment) |
|
150 |
|
|
Nonfunctional code (Empty line) |
|
151 |
/* End of Switch: '<S6>/Switch' */
|
|
Nonfunctional code (Comment) |
|
152 |
|
|
Nonfunctional code (Empty line) |
|
153 |
/* Switch: '<S6>/Switch2' incorporates:
|
|
Nonfunctional code (Comment) |
|
154 |
* RelationalOperator: '<S6>/LowerRelop1'
|
|
Nonfunctional code (Comment) |
|
155 |
*/
|
|
Nonfunctional code (Comment) |
|
156 |
if (rtb_UkYk1 > rtb_deltariselimit) {
|
|
- |
|
157 |
rtb_Switch2 = rtb_deltariselimit;
|
|
- |
|
158 |
} else {
|
|
- |
|
159 |
rtb_Switch2 = rtb_Switch;
|
|
- |
|
160 |
}
|
|
Nonfunctional code (End of code segment) |
|
161 |
|
|
Nonfunctional code (Empty line) |
|
162 |
/* End of Switch: '<S6>/Switch2' */
|
|
Nonfunctional code (Comment) |
|
163 |
|
|
Nonfunctional code (Empty line) |
|
164 |
/* Sum: '<S4>/Difference Inputs2' incorporates:
|
|
Nonfunctional code (Comment) |
|
165 |
* UnitDelay: '<S4>/Delay Input2'
|
|
Nonfunctional code (Comment) |
|
166 |
*/
|
|
Nonfunctional code (Comment) |
|
167 |
*rty_ThetaCmd = rtb_Switch2 + localDW->DelayInput2_DSTATE;
|
|
- |
|
168 |
|
|
Nonfunctional code (Empty line) |
|
169 |
/* Switch: '<S5>/Switch1' */
|
|
Nonfunctional code (Comment) |
|
170 |
if (rtb_NotALT) {
|
|
- |
|
171 |
/* Update for UnitDelay: '<S5>/X' */
|
|
Nonfunctional code (Comment) |
|
172 |
localDW->X_DSTATE = rtb_Sum3;
|
|
- |
|
173 |
} else {
|
|
- |
|
174 |
/* Update for UnitDelay: '<S5>/X' incorporates:
|
|
Nonfunctional code (Comment) |
|
175 |
* Product: '<S5>/Product1'
|
|
Nonfunctional code (Comment) |
|
176 |
* Sum: '<S5>/Sum'
|
|
Nonfunctional code (Comment) |
|
177 |
*/
|
|
Nonfunctional code (Comment) |
|
178 |
localDW->X_DSTATE = (Altitude_Mode_ConstB.Product * rtb_Saturation) +
|
|
- |
|
179 |
rtb_Saturation_krec;
|
|
- |
|
180 |
}
|
|
Nonfunctional code (End of code segment) |
|
181 |
|
|
Nonfunctional code (Empty line) |
|
182 |
/* End of Switch: '<S5>/Switch1' */
|
|
Nonfunctional code (Comment) |
|
183 |
|
|
Nonfunctional code (Empty line) |
|
184 |
/* Update for UnitDelay: '<S4>/Delay Input2' */
|
|
Nonfunctional code (Comment) |
|
185 |
localDW->DelayInput2_DSTATE = *rty_ThetaCmd;
|
|
- |
|
186 |
}
|
|
Nonfunctional code (End of code segment) |
|
187 |
|
|
Nonfunctional code (Empty line) |
|
188 |
/* Model initialize function */
|
|
Nonfunctional code (Comment) |
|
189 |
void Altitude_Mode_initialize(rtB_Altitude_Mode *localB, rtDW_Altitude_Mode
|
|
- |
|
190 |
*localDW)
|
|
- |
|
191 |
{
|
|
Nonfunctional code (Start of code segment) |
|
192 |
/* Registration code */
|
|
Nonfunctional code (Comment) |
|
193 |
|
|
Nonfunctional code (Empty line) |
|
194 |
/* block I/O */
|
|
Nonfunctional code (Comment) |
|
195 |
(void) memset(((void *) localB), 0,
|
|
- |
|
196 |
sizeof(rtB_Altitude_Mode));
|
|
- |
|
197 |
|
|
Nonfunctional code (Empty line) |
|
198 |
/* states (dwork) */
|
|
Nonfunctional code (Comment) |
|
199 |
(void) memset((void *)localDW, 0,
|
|
- |
|
200 |
sizeof(rtDW_Altitude_Mode));
|
|
- |
|
201 |
}
|
|
Nonfunctional code (End of code segment) |
|
202 |
|
|
Nonfunctional code (Empty line) |
|
203 |
/*
|
|
Nonfunctional code (Comment) |
|
204 |
* File trailer for generated code.
|
|
Nonfunctional code (Comment) |
|
205 |
*
|
|
Nonfunctional code (Comment) |
|
206 |
* [EOF]
|
|
Nonfunctional code (Comment) |
|
207 |
*/
|
|
Nonfunctional code (Comment) |